<!-- DateTitle -->
<template>
  <view class="DateTitle fc8" :class="{ active: check }">
    <!-- #ifdef MP-ALIPAY  -->
    <rich-text class="d-content" :nodes="str"></rich-text>
    <!-- #endif -->
    <!-- #ifndef MP-ALIPAY -->

    <view class="d-content" v-html="str"> </view>
    <!-- #endif -->
  </view>
</template>

<script>
  // #ifdef MP-ALIPAY
  import parseHtml from '@/utils/htmlParser'
  // #endif
  export default {
    name: 'DateTitle',
    props: {
      value: {
        type: String,
        default: ''
      },
      active: {
        type: Boolean,
        default: false
      },
      check: {
        type: Boolean,
        default: false
      }
    },
    data() {
      return {}
    },
    computed: {
      str() {
        let html = ''
        if (this.value.indexOf('-') !== -1) {
          // #ifdef MP-ALIPAY
          html = parseHtml(this.value.split('-').join('<br/>'))
          // #endif
          // #ifndef MP-ALIPAY
          html = this.value.split('-').join('<br/>')
          // #endif
          return html
        }
        // #ifdef MP-ALIPAY
        html = parseHtml(this.value.split('').join('<br/>'))
        // #endif
        // #ifndef MP-ALIPAY
        html = this.value.split('').join('<br/>')
        // #endif
        return html
      }
    }
  }
</script>
<style lang="scss" scoped>
  .DateTitle {
    align-items: center;
    width: 40rpx;
    height: 110rpx;
    background: #e0e0e0;
    text-align: center;
    position: relative;
    border-radius: 10rpx;
    box-sizing: border-box;
    font-size: 24rpx;
    margin-right: 20rpx;
  }
  .active {
    color: #fff;
    background: linear-gradient(135deg, #55baff 0%, #23e6d8 100%);
    .d-content {
      color: #fff;
    }
  }
  .d-content {
    position: absolute;
    top: 50%;
    left: 50%;

    color: #fff;
    transform: translate(-50%, -50%);
  }
</style>
